<?php

/**
 * Usuario form base class.
 *
 * @method Usuario getObject() Returns the current form's model object
 *
 * @package    sms
 * @subpackage form
 * @author     Patricio Andrés Córdova De La Cruz
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseUsuarioForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'usuario_id'     => new sfWidgetFormInputHidden(),
      'nombre'         => new sfWidgetFormInputText(),
      'apellido'       => new sfWidgetFormInputText(),
      'email'          => new sfWidgetFormInputText(),
      'cargo'          => new sfWidgetFormInputText(),
      'nombre_usuario' => new sfWidgetFormInputText(),
      'contrasena'     => new sfWidgetFormInputText(),
      'salt'           => new sfWidgetFormInputText(),
      'telefono1'      => new sfWidgetFormInputText(),
      'telefono2'      => new sfWidgetFormInputText(),
      'telefono3'      => new sfWidgetFormInputText(),
      'estado'         => new sfWidgetFormInputText(),
      'tipo'           => new sfWidgetFormInputText(),
      'ultimo_login'   => new sfWidgetFormDateTime(),
      'created_at'     => new sfWidgetFormDateTime(),
      'updated_at'     => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'usuario_id'     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('usuario_id')), 'empty_value' => $this->getObject()->get('usuario_id'), 'required' => false)),
      'nombre'         => new sfValidatorString(array('max_length' => 64)),
      'apellido'       => new sfValidatorString(array('max_length' => 64)),
      'email'          => new sfValidatorString(array('max_length' => 32, 'required' => false)),
      'cargo'          => new sfValidatorInteger(),
      'nombre_usuario' => new sfValidatorString(array('max_length' => 32)),
      'contrasena'     => new sfValidatorString(array('max_length' => 128)),
      'salt'           => new sfValidatorString(array('max_length' => 128)),
      'telefono1'      => new sfValidatorString(array('max_length' => 12)),
      'telefono2'      => new sfValidatorString(array('max_length' => 12, 'required' => false)),
      'telefono3'      => new sfValidatorString(array('max_length' => 12, 'required' => false)),
      'estado'         => new sfValidatorInteger(),
      'tipo'           => new sfValidatorInteger(),
      'ultimo_login'   => new sfValidatorDateTime(array('required' => false)),
      'created_at'     => new sfValidatorDateTime(array('required' => false)),
      'updated_at'     => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('usuario[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Usuario';
  }

}
